POV-Ray : Newsgroups : povray.binaries.images : Amazonas : Re: Amazonas Server Time
27 Apr 2024 11:57:21 EDT (-0400)
  Re: Amazonas  
From: Jaime Vives Piqueres
Date: 18 May 2010 08:59:55
Message: <4bf28f4b@news.povray.org>

> Awesome!

   Thanks!

> How do you place trees with a pigment function? I would like to do the
> same with the grass in my alley scene, so the grass won't grow on the
> asphalt...

   Indeed you could use this technique for that... it's very easy, specially
if you are already using a heighfield for the ground. Make a copy of the
grayscale map, and paint black the zones where you don't want grass, and
white for the rest. Then declare a pigment function of it:

#declare f_grass_distribution=
   function{
    pigment{
     image_map{png "your_image.png"}
     rotate 90*x
     translate <-.5,0,-.5>
     scale as_your_heightfield
    }
   }

   Now, build the classic while loop where you shot the heighfield with
trace(), but for each placement found, test first if the grass distribution
allows a grass patch there:

   ...
   #if (f_grass_distribution(Inter.x,0,Inter.z).gray>0)
    object{grass_patch
      ...
      translate Inter
    }
   #end
   ...

   Hope this helps...


-- 
Jaime Vives Piqueres

http://www.ignorancia.org


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.